home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-07-29 | 1.2 KB | 50 lines | [TEXT/MPS ] |
- # CommentLine - Comment-out a selection of program lines in the active window
-
- Set GoOn 1
- If {#} >= 2
- # impose comment type
- If "{2}" == "-a"
- # assembler
- Set ComStr "; "
- Else
- If "{2}" == "-m"
- # MPW script
- Set ComStr "# "
- Else
- If "{2}" == "-c"
- # C or C++
- Set ComStr "∂/∂/ "
- Else
- Alert "{0}:∂nUsage: {0} [-a | -m | -c]"
- Set GoOn 0
- End # If "{2}"
- End # If "{2}"
- End # If "{2}"
- Else
- # infer comment type from file extension
- Set GoOn 1
- Set Extension "`Echo "{Active}" | StreamEdit -d -e '/(.≈)®1/ Print ®1' ≥ Dev:Null`"
- If (({Extension} == ".a") || ({Extension} == ".A") || ({Extension} == ".Asm") || ({Extension} == ".Asm"))
- # assembler
- Set ComStr1 "; "
- Else
- If (({Extension} == ".C") || ({Extension} == ".h") || ({Extension} == ".r") || ({Extension} == ".C") || ({Extension} == ".H") || ({Extension} == ".R"))
- # C, C++, or Rez
- Set ComStr "∂/∂/ "
- Else
- If {Extension} == ""
- # MPW script
- Set ComStr "# "
- Else
- Alert "{0}:∂nCan't determine comment style from file extension"
- Set GoOn 0
- End # If {Extension}
- End # If {Extension}
- End # If {Extension}
- End # If {#}
-
- If ({GoOn} == 1)
- ColumnShiftTool -r "{ComStr}"
- End # If {GoOn}
-
- # end of CommentLine